﻿using ShareFrame.Entity.Base_Manage;
using ShareFrame.Util;
using System.Collections.Generic;

namespace ShareFrame.Entity
{
    [Map(typeof(Base_User))]
    public class Base_UserDTO : Base_User
    {
        public string RoleNames { get => string.Join(",", RoleNameList ?? new List<string>()); }
        public List<string> RoleIdList { get; set; }
        public List<string> RoleNameList { get; set; }
        public RoleTypes RoleType
        {
            get
            {
                int type = 0;

                var values = typeof(RoleTypes).GetEnumValues();
                foreach (var aValue in values)
                {
                    if (RoleNames.Contains(aValue.ToString()))
                        type += (int)aValue;
                }

                return (RoleTypes)type;
            }
        }
        public string DepartmentName { get; set; }
        public string SexText { get => Sex.GetDescription(); }
        public string BirthdayText { get => Birthday?.ToString("yyyy-MM-dd"); }
    }

    /// <summary>
    /// 用户头像更新传入的参数对象
    /// </summary>
    public class Base_UserUpdateUserAvatar
    {
        /// <summary>
        /// 用户ID
        /// </summary>
        public string Id { get; set; }

        /// <summary>
        /// 更新条件组
        /// </summary>
        public ConditionDTO Search { get; set; }

    }
}
